@import '../../styles/var.less';

.k-poptip {
  display: inline-block;
  position: relative;
  // max-width: 300px;
  // color: #fff;
  color: var(--kui-color-font);
  font-size: 12px;
  line-height: 1.5;
  position: absolute;
  z-index: 1001;
  transform: translateZ(0);

  &[k-placement^=top] {
    .k-poptip-arrow {
      bottom: -7px;
      height: 9px;

      svg {
        filter: drop-shadow(0px 4px 2px rgba(0, 0, 0, .1));
      }
    }

    .k-poptip-content {
      margin-bottom: 12px;
    }
  }

  &[k-placement=top] {
    .k-poptip-arrow {
      left: 50%;
      transform: translateX(-50%);
    }
  }

  &[k-placement=top-right] {
    .k-poptip-arrow {
      right: 12px;
    }
  }

  &[k-placement=top-left] {
    .k-poptip-arrow {
      left: 12px;
    }
  }

  &[k-placement^=bottom] {
    .k-poptip-arrow {
      top: -7px;
      height: 9px;
      transform: rotate(180deg);

      svg {
        filter: drop-shadow(0px 2px 1px rgba(0, 0, 0, 0.05));
      }
    }

    .k-poptip-content {
      margin-top: 12px;
    }
  }

  &[k-placement=bottom] {
    .k-poptip-arrow {
      left: 50%;
      transform: translateX(-50%) rotate(180deg);
    }
  }

  &[k-placement=bottom-left] {
    .k-poptip-arrow {
      left: 12px;
    }
  }

  &[k-placement=bottom-right] {
    .k-poptip-arrow {
      right: 12px;
    }
  }

  &[k-placement^=left] {
    .k-poptip-arrow {
      right: -14px;
      width: 23px;
      height: 9px;
      transform: rotate(-90deg);

      svg {
        filter: drop-shadow(0px 2px 1px rgba(0, 0, 0, 0.05));
      }
    }

    .k-poptip-content {
      margin-right: 12px;
    }
  }

  &[k-placement=left] {
    .k-poptip-arrow {
      top: 50%;
      transform: translateY(-50%) rotate(-90deg);
    }
  }

  &[k-placement=left-bottom] {
    .k-poptip-arrow {
      bottom: 14px;
    }
  }

  &[k-placement=left-top] {
    .k-poptip-arrow {
      top: 14px;
    }
  }

  &[k-placement^=right] {
    .k-poptip-arrow {
      left: -14px;
      width: 23px;
      height: 9px;
      transform: rotate(90deg);

      svg {
        filter: drop-shadow(0px 2px 1px rgba(0, 0, 0, 0.05));
      }
    }

    .k-poptip-content {
      margin-left: 12px;
    }
  }

  &[k-placement=right] {
    .k-poptip-arrow {
      top: 50%;
      transform: translateY(-50%) rotate(90deg);
    }
  }

  &[k-placement=right-top] {
    .k-poptip-arrow {
      top: 14px;
    }
  }

  &[k-placement=right-bottom] {
    .k-poptip-arrow {
      bottom: 14px;
    }
  }
}

.k-poptip-content {
  min-width: 200px;
  // .k-poptip-inner {
  // background: var(--kui-color-control-10);
  background: var(--kui-color-control-10);
  // background: #333; //var(--kui-color-control-10);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-radius: 8px; // var(--kui-border-radius);
  position: relative;
  border: 1px solid var(--kui-color-border);

  #ot {
    stroke-width: 0.1em;
    stroke: var(--kui-color-border);
  }

  // }
  .k-poptip-body {
    font-size: 14px;
    padding: 8px 16px;
    box-sizing: border-box;
  }

  .k-poptip-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--kui-color-font);
    // color: #fff;
    margin: 0;
    padding: 8px 16px;
    position: relative;
    // border-bottom: 1px solid var(--kui-color-gray-80);
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .k-poptip-arrow {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    width: 24px;
    height: 7px;
    color: var(--kui-color-control-10);
    // color: #333;
    // color: var(--kui-color-control-10);
  }
}

.k-poptip-dark {
  .k-poptip-title {
    color: #fff;
  }

  .k-poptip-content {
    // background: #333;
    color: #fff;
    background-color: @dark-back-color-10;
  }

  .k-poptip-arrow {
    color: @dark-back-color-10;
  }
}

@keyframes k-pop-zoom {
  from {
    opacity: 0;
    transform: scale(.8, .8);
  }

  to {
    opacity: 1;
    transform: scale(1, 1);
  }
}


.k-poptip-enter-active {
  // transform-origin: center bottom;
  animation: k-pop-zoom .3s;
}

.k-poptip-leave-active {
  // transform-origin: center bottom;
  animation: k-pop-zoom .3s reverse;
}